
import request from '@/utils/request'

const api = {
    getLaborBindAccountList: '/v1/labor/account/can/bind/list', // 获取劳务可绑定账户列表
    bindBusinessAccount: '/v1/customer/business/account/bind/or/unbind', // 客户业务绑定支付账户
    getAccountListByBusiness: '/v1/labor/account/customer/business/page/list', // 客户业务账户列表
    getAccountList: '/v1/labor/account/page/list', // 获取账户分页列表数据
    createLaborAccount: '/v1/labor/account/create', // 创建劳务账号
    updateLaborAccount: '/v1/labor/account/update', // 修改劳务账号
    getLaborAccountDetail: '/v1/labor/account/detail/', // 获取账户详情
    updateLaborWithdrawalAccount: '/v1/labor/account/withdrawal/account/create/or/update', // 提现账户设置或修改
    updateWithdrawAccountConfig: '/v1/labor/account/withdrawal/account/create/or/update', // 设置、修改提现账户配置
    getLaborWithdrawConfig: '/v1/labor/account/withdrawal/account/detail/', // 获取提现账户信息
    setPayPassword: '/v1/labor/account/deal/password/set',  // 设置账户交易密码
    updatePayPassword: '/v1/labor/account/deal/password/change', // 修改交易密码
    getHasPayPassword: '/v1/labor/account/has/deal/password/', // 查询是否设置过交易密码
    changeAccountDealPasswordStatus: '/v1/labor/account/deal/password/status/change', // 切换是否需要交易密码
    updateAccountRechargeInfo: '/v1/labor/account/recharge/info/create/or/update', // 设置充值信息
    getAccountRechargeInfo: '/v1/labor/account/recharge/info/detail/', // 获取充值信息
    getAccountBySettlement: '/v1/applet/settlement/alive/account/', // 根据结算单获取已绑定账户列表信息
    getAccountBalance: '/v1/labor/account/balance/', // 获取账户余额信息
    accountWithdraw: '/v1/labor/account/withdraw', // 账户提现
    getWithdrawList: '/v1/labor/account/withdraw/page/list', // 获取提现列表数据
    getAccountRechargeList: '/v1/labor/account/recharge/page/list', // 获取充值记录
    getAccountTransctionList: '/v1/labor/account/transaction/page/list', // 获取交易流水记录
    exportAccountRechargeList: '/v1/labor/account/recharge/page/list/export', // 导出充值记录
    downloadAccountWithdrawList: '/v1/labor/account/withdraw/page/list/export', // 导出提现记录
    downloadAccountTransactionList: '/v1/labor/account/transaction/page/list/export', // 导出流水记录
    getAllAccountParentList: '/v1/labor/account/parent/list', // 获取所有父账户信息
    getSubAccountList: '/v1/labor/sub/account/page/list', // 子账户分页列表
    createSubAccount: '/v1/labor/sub/account/create', // 创建子账户
    updateSubAccount: '/v1/labor/sub/account/update', // 修改子账户
    closeSubAccount: '/v1/labor/sub/account/close', // 关闭子账户
}

// 获取劳务可绑定账户列表
export function getLaborBindAccountList (parameter) {
    return request({
        url: api.getLaborBindAccountList,
        method: 'get',
        headers: {
            'name':'getLaborBindAccountList',
        },
        params: parameter
    })
}

// 客户业务绑定支付账户
export function bindBusinessAccount (parameter) {
    return request({
        url: api.bindBusinessAccount,
        method: 'post',
        headers: {
            'name':'bindBusinessAccount',
        },
        data: parameter
    })
}

// 客户业务账户列表信息
export function getAccountListByBusiness (parameter) {
    return request({
        url: api.getAccountListByBusiness,
        method: 'get',
        headers: {
            'name':'getAccountListByBusiness',
        },
        params: parameter
    })
}

// 获取账户分页列表
export function getAccountList (parameter) {
    return request({
        url: api.getAccountList,
        method: 'get',
        headers: {
            'name':'getAccountList',
        },
        params: parameter
    })
}

// 创建劳务账号
export function createLaborAccount (parameter) {
    return request({
        url: api.createLaborAccount,
        method: 'post',
        headers: {
            'name':'createLaborAccount',
        },
        data: parameter
    })
}

// 修改劳务账号
export function updateLaborAccount (parameter) {
    return request({
        url: api.updateLaborAccount,
        method: 'post',
        headers: {
            'name':'updateLaborAccount',
        },
        data: parameter
    })
}

// 获取账户详情
export function getLaborAccountDetail (accountId) {
    return request({
        url: api.getLaborAccountDetail + accountId,
        method: 'get',
        headers: {
            'name':'getLaborAccountDetail',
        },
        params: {}
    })
}

// 设置劳务提现账号
export function updateLaborWithdrawalAccount (parameter) {
    return request({
        url: api.updateLaborWithdrawalAccount,
        method: 'post',
        headers: {
            'name':'updateLaborWithdrawalAccount',
        },
        data: parameter
    })
}

// 设置、修改提现账户配置
export function updateWithdrawAccountConfig (parameter) {
    return request({
        url: api.updateWithdrawAccountConfig,
        method: 'post',
        headers: {
            'name':'updateWithdrawAccountConfig',
        },
        data: parameter
    })
}

// 获取提现账户信息
export function getLaborWithdrawConfig (accountId) {
    return request({
        url: api.getLaborWithdrawConfig + accountId,
        method: 'get',
        headers: {
            'name':'getLaborWithdrawConfig',
        },
        params: {}
    })
}

// 查询是否设置过交易密码
export function getHasPayPassword (accountId) {
    return request({
        url: api.getHasPayPassword + accountId,
        method: 'get',
        headers: {
            'name':'getHasPayPassword',
        },
        params: {}
    })
}

// 设置交易密码
export function setPayPassword (parameter) {
    return request({
        url: api.setPayPassword,
        method: 'post',
        headers: {
            'name':'setPayPassword',
        },
        data: parameter
    })
}

// 修改交易密码
export function updatePayPassword (parameter) {
    return request({
        url: api.updatePayPassword,
        method: 'post',
        headers: {
            'name':'updatePayPassword',
        },
        data: parameter
    })
}

// 设置充值信息
export function updateAccountRechargeInfo (parameter) {
    return request({
        url: api.updateAccountRechargeInfo,
        method: 'post',
        headers: {
            'name':'updateAccountRechargeInfo',
        },
        data: parameter
    })
}

// 获取充值信息
export function getAccountRechargeInfo (accountId) {
    return request({
        url: api.getAccountRechargeInfo + accountId,
        method: 'get',
        headers: {
            'name':'getAccountRechargeInfo',
        },
        params: {}
    })
}

// 根据结算单获取已绑定账户列表数据
export function getAccountBySettlement (settlementId) {
    return request({
        url: api.getAccountBySettlement + settlementId,
        method: 'get',
        headers: {
            'name':'getAccountBySettlement',
        },
        params: {}
    })
}

// 获取账户余额信息 
export function getAccountBalance (accountId) {
    return request({
        url: api.getAccountBalance + accountId,
        method: 'get',
        headers: {
            'name':'getAccountBalance',
        },
        params: {}
    })
}

// 账户提现 
export function accountWithdraw (parameter) {
    return request({
        url: api.accountWithdraw,
        method: 'post',
        headers: {
            'name':'accountWithdraw',
        },
        data: parameter
    })
}

// 获取提现记录 
export function getWithdrawList (parameter) {
    return request({
        url: api.getWithdrawList,
        method: 'get',
        headers: {
            'name':'getWithdrawList',
        },
        params: parameter
    })
}

// 切换是否需要交易密码 
export function changeAccountDealPasswordStatus (parameter) {
    return request({
        url: api.changeAccountDealPasswordStatus,
        method: 'post',
        headers: {
            'name':'changeAccountDealPasswordStatus',
        },
        data: parameter
    })
}

// 获取账户充值记录
export function getAccountRechargeList (parameter) {
    return request({
        url: api.getAccountRechargeList,
        method: 'get',
        headers: {
            'name':'getAccountRechargeList',
        },
        params: parameter
    })
}

// 获取交易流水记录 
export function getAccountTransctionList (parameter) {
    return request({
        url: api.getAccountTransctionList,
        method: 'get',
        headers: {
            'name':'getAccountTransctionList',
        },
        params: parameter
    })
}

// 导出充值记录
export function exportAccountRechargeList (parameter) {
    return request({
        url: api.exportAccountRechargeList,
        method: 'get',
        responseType: "arraybuffer",
        headers: {
            'name':'exportAccountRechargeList',
        },
        params: parameter
    })
}

// 导出提现记录
export function downloadAccountWithdrawList (parameter) {
    return request({
        url: api.downloadAccountWithdrawList,
        method: 'get',
        responseType: "arraybuffer",
        headers: {
            'name':'downloadAccountWithdrawList',
        },
        params: parameter
    })
}

// 导出流水记录
export function downloadAccountTransactionList (parameter) {
    return request({
        url: api.downloadAccountTransactionList,
        method: 'get',
        responseType: "arraybuffer",
        headers: {
            'name':'downloadAccountTransactionList',
        },
        params: parameter
    })
}

// 获取所有父账户信息列表
export function getAllAccountParentList (parameter) {
    return request({
        url: api.getAllAccountParentList,
        method: 'get',
        headers: {
            'name':'getAllAccountParentList',
        },
        params: parameter
    })
}
// 获取子账户分页列表
export function getSubAccountList (parameter) {
    return request({
        url: api.getSubAccountList,
        method: 'get',
        headers: {
            'name':'getSubAccountList',
        },
        params: parameter
    })
}
// 创建子账户
export function createSubAccount (parameter) {
    return request({
        url: api.createSubAccount,
        method: 'post',
        headers: {
            'name':'createSubAccount',
        },
        data: parameter
    })
}
// 修改子账户
export function updateSubAccount (parameter) {
    return request({
        url: api.updateSubAccount,
        method: 'post',
        headers: {
            'name':'updateSubAccount',
        },
        data: parameter
    })
}
// 关闭子账户
export function closeSubAccount (parameter) {
    return request({
        url: api.closeSubAccount,
        method: 'post',
        headers: {
            'name':'closeSubAccount',
        },
        data: parameter
    })
}